#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    m_pTimer = new QTimer(this);

    ui->progressBar->setValue(0);
    ui->progressBar->setRange(0, 100);

    connect(m_pTimer, &QTimer::timeout, [=]{
        static int step = 0;
        ui->progressBar->setValue(step++);
    });
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_btnStart_clicked()
{
    m_pTimer->start(300);
}

void Widget::on_btnEnd_clicked()
{
  m_pTimer->stop();
}
